cmake_minimum_required(VERSION 2.8.12)

PROJECT(savgol)

SET(CMAKE_BUILD_TYPE Debug)

find_package(PkgConfig)
pkg_check_modules( EIGEN3 REQUIRED eigen3 )
include_directories( ${EIGEN3_INCLUDE_DIRS} )

add_definitions(${EIGEN_DEFINITIONS})

OPTION(ENABLE_CXX17 "Enable C++17 support" ON)

IF(ENABLE_CXX17)
  INCLUDE(CheckCXXCompilerFlag)
  CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
  CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
  IF(COMPILER_SUPPORTS_CXX17)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
  ELSEIF(COMPILER_SUPPORTS_CXX0X)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  ELSE()
    MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
  ENDIF()
ENDIF(ENABLE_CXX17)

INCLUDE_DIRECTORIES(EIGEN3_INCLUDE_DIRS
                AND "${PROJECT_SOURCE_DIR}/include")


#Declare the executable target built from your sources
add_executable(savgol tests.cpp)
